package com.example.day07;

import com.sun.org.apache.xpath.internal.objects.XString;

public class ExceptionTest {
    public static void main(String[] args) {
        try{
            //System.out.println(1 / 0);
            String s = null; // = "hello";
            System.out.println(s.length());// NPE
            System.out.println("hello".charAt(5));
            System.out.println(new int[]{1, 2, 3}[-1]);
        } catch (ArithmeticException arithmeticException){
            arithmeticException.printStackTrace();

        } catch (IndexOutOfBoundsException indexOutOfBoundsException){
            indexOutOfBoundsException.printStackTrace();
        } catch (NullPointerException nullPointerException){
            nullPointerException.printStackTrace();
            //System.exit(1);
            //System.out.println("NPE");
        }finally {
            System.out.println("finally");

        }
        System.out.println("test");

        //String s = null; // = "hello';
       // System.out.println(s.length());//NPE
    }
}
